tail recursion optimisation - definizione. Che cos'è tail recursion optimisation
Diclib.com
Dizionario ChatGPT
Inserisci una parola o una frase in qualsiasi lingua 👆
Lingua:

Traduzione e analisi delle parole tramite l'intelligenza artificiale ChatGPT

In questa pagina puoi ottenere un'analisi dettagliata di una parola o frase, prodotta utilizzando la migliore tecnologia di intelligenza artificiale fino ad oggi:

  • come viene usata la parola
  • frequenza di utilizzo
  • è usato più spesso nel discorso orale o scritto
  • opzioni di traduzione delle parole
  • esempi di utilizzo (varie frasi con traduzione)
  • etimologia

Cosa (chi) è tail recursion optimisation - definizione

SUBROUTINE THAT CALLS ITSELF AS ITS FINAL ACTION
Tail recursion; Tail recursion modulo cons; Tail-recursive; Tail recursive; Tail call optimization; Tail Recursion; Tail-call optimization; Tailcall; Tail-call optimisation; Tail-call elimination; Tail-recursion; Tail-end recursion; Tail call elimination; Tail recursion elimination; Tail recursion optimization; Tail-recursion optimization; Proper tail recursion; Tail function; Tail recursive function; Tail-recursive function

tail recursion optimisation      
<programming> (TRO) Discarding the calling environment ({call stack} frame) when the last thing a function or procedure does is to call itself. This is important when a procedure calls itself recursively many times since, without tail recursion optimisation, the environments of earlier invocations would fill up the memory only to be discarded when (if) the last call terminated. Tail recursion optimisation is a special case of {last call optimisation} but it allows the further optimisation that some arguments may be passed in situ, possibly in registers. It allows recursive functions to be compiled into iterative loops. See also conversion to iteration, {tail recursion modulo cons}. (2006-04-16)
Tail call         
In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion.
tail recursion         
<programming> When the last thing a function (or procedure) does is to call itself. Such a function is called tail recursive. A function may make several recursive calls but a call is only tail-recursive if the caller returns immediately after it. E.g. f n = if n < 2 then 1 else f (f (n-2) + 1) In this example both calls to f are recursive but only the outer one is tail recursive. Tail recursion is a useful property because it enables {tail recursion optimisation}. If you aren't sick of them already, see recursion and {tail recursion}. [Jargon File] (2006-04-16)

Wikipedia

Tail call

In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recursion (or tail-end recursion) is particularly useful, and is often easy to optimize in implementations.

Tail calls can be implemented without adding a new stack frame to the call stack. Most of the frame of the current procedure is no longer needed, and can be replaced by the frame of the tail call, modified as appropriate (similar to overlay for processes, but for function calls). The program can then jump to the called subroutine. Producing such code instead of a standard call sequence is called tail-call elimination or tail-call optimization. Tail-call elimination allows procedure calls in tail position to be implemented as efficiently as goto statements, thus allowing efficient structured programming. In the words of Guy L. Steele, "in general, procedure calls may be usefully thought of as GOTO statements which also pass parameters, and can be uniformly coded as [machine code] JUMP instructions."

Not all programming languages require tail-call elimination. However, in functional programming languages, tail-call elimination is often guaranteed by the language standard, allowing tail recursion to use a similar amount of memory as an equivalent loop. The special case of tail-recursive calls, when a function calls itself, may be more amenable to call elimination than general tail calls. When the language semantics do not explicitly support general tail calls, a compiler can often still optimize sibling calls, or tail calls to functions which take and return the same types as the caller.